package com.youthHostel.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.youthHostel.dao.LeaseContractDao;
import com.youthHostel.dao.LesseeDao;
import com.youthHostel.pojo.house;
import com.youthHostel.pojo.leasecontract;
import com.youthHostel.pojo.lessee;
import com.youthHostel.service.LeaseContractService;
import com.youthHostel.service.LesseeService;

@Service
public class LesseeServiceImpl implements LesseeService{

	@Autowired
	private LesseeDao lesseeDao;

	@Override
	public int addLessee(lessee lessees) {
		return lesseeDao.insertLessee(lessees);
	}

	@Override
	public PageInfo<lessee> findAlllessee(int index) {
		PageHelper.startPage(index, 3);
		List<lessee> lesseeList = lesseeDao.queryLesseeList();
		return new PageInfo<>(lesseeList);
	}

	@Override
	public int removeLesseeById(int id) {
		return lesseeDao.deleteLesseeById(id);
	}

	@Override
	public lessee findLesseeMesById(int id) {
		return lesseeDao.queryLesseeMesById(id);
	}

	@Override
	public int updateLesseeMes(lessee lessees) {
		return lesseeDao.updateLesseeMes(lessees);
	}

	@Override
	public List<lessee> findHouseByKey(String name) {
		return lesseeDao.queryHouseByKey(name);
	}
	
	

}
